﻿<?php
$CI =& get_instance();
$CI->load->library('pagination');
$CI->load->model('Model_product', 'model_product');

$t1 = $content['t1'];
$t1 = unserialize($t1);
$media_thumb = $CI->config->item("media_thumb");
$total = $CI->model_product->browse_count($t1['gids'],null,null,null);
$offset = 0;
$limit = $t1['quantity'];
$product_list = $CI->model_product->browse($t1['gids'],null,null,null,$limit,$offset);
?>
<div class="product-cont">
	<?php if(!empty($product_list)):?>
	<a class="product-prev browse left"></a>
	<div class="product-grid">
		<div class="items">
			<?php $k = 0;foreach($product_list as $item):?>
				<?php if($k==0 || $k%6==0):?>
				<div style="float:left; width: 864px;">
				<?php endif;?>
				<div class="item">
					<a class="customGal" href="<?=$item['link']?>" title="<?=$item['description']?>" style="width: 120px" target="_blank">
						<img src="<?=$media_thumb['user_media_url'].$item['rawname'].$media_thumb['thumb_marker'].$item["fileext"]?>" alt="<?=$item['title']?>" width="120" height="120"/>							
					</a>					
					<div class="meta">
						<div><b><?=substr($item['title'], 0, 16)?></b></div>
						<div>Price: $<?=number_format($item['price'], 0, ',', '.')?></div>
					</div>
				</div>
				<?php if((($k != 0) && ($k % 6 == 5)) || ($k+1==count($product_list))):?>
				</div>
				<?php endif;?>
			<?php $k++; endforeach; ?>					
		</div>		
	</div>
	<a class="product-next browse right"></a>
	<?php endif;?>
	<div class="clearfix"></div>
</div>
<?php if(count($product_list) > 6):?>
<script type="text/javascript">
$(function(){	
	$("div.product-grid").scrollable({circular: true, mousewheel: true, next: '.product-next', prev: '.product-prev'});
});
</script>
<?php endif;?>
